#!/bin/bash

# 获取所有conda环境路径
envs=$(conda env list | grep -o '/.*')

# 定义一个函数来获取文件夹大小，并以GB为单位显示
get_folder_size_in_gb() {
    local path=$1
    size_in_gb=$(du -sh "$path" | cut -f1)
    echo $size_in_gb
}

# 遍历每个环境并获取其大小
for env in $envs; do
    if [ -d "$env" ]; then
        folder_size_gb=$(get_folder_size_in_gb "$env")
        echo "Environment: $env"
        echo "Size: $folder_size_gb"
    else
        echo "Environment $env does not exist or is not a valid directory."
    fi
done
